package com.web.service;

import com.web.VO.MyApplyVO;
import com.web.VO.MyPublishVO;
import com.web.VO.MyRecruitVO;
import com.web.dao.*;
import com.web.entity.*;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class JobService {
    @Resource
    private JobMapper jobMapper;
    @Resource
    private JobApplyMapper jobApplyMapper;

    /**
     * 发布求职
     * @param jobHunting
     */
    public void insertjobHunting(JobHunting jobHunting) {
        jobMapper.insertjobHunting(jobHunting);

    }

    /**
     * 查询所有求职信息
     * @return
     * @param longitude
     * @param latitude
     * @param min_salary
     * @param max_salary
     */
    public List<JobList> getJobList(String longitude, String latitude, String min_salary, String max_salary) {
       return  jobMapper.getJobList(longitude,latitude,min_salary,max_salary);
    }
    public List<JobList> getJobListtwo(String min_salary, String max_salary) {
        return jobMapper.getJobListtwo(min_salary,max_salary);
    }

    /**
     * 学历列表
     * @return
     */
    public List<UserEdu> getEducationList() {
        return jobMapper.getEducationList();
    }

    /**
     * 发布招聘
     * @param techRecriitment
     */
    public void insertEnterpriseRecruitment(TechRecriitment techRecriitment) {
        jobMapper.insertEnterpriseRecruitment(techRecriitment);
    }

    /**
     * 招聘详情
     * @param id
     * @param userId
     * @return
     */
    public RecruitmentDetails getRecruitmentDetails(int id, String userId) {
        return jobMapper.getRecruitmentDetails(id,userId);
    }

    /**
     * 临工求职详情
     * @param id
     * @param userId
     * @return
     */
    public TemporaryWorkDetails getTemporaryWorkDetails(int id, String userId) {
        return jobMapper.getTemporaryWorkDetails(id,userId);
    }

    /**
     * 临时工求职列表
     * @param min_salary
     * @param max_salary
     * @return
     */
    public List<JobList> getTemporaryWorkers(String min_salary, String max_salary) {
        return jobMapper.getTemporaryWorkers(min_salary,max_salary);
    }

    public List<JobList> TemporaryWorkersList(String longitude, String latitude, String min_salary, String max_salary) {
        return  jobMapper.TemporaryWorkersList(longitude,latitude,min_salary,max_salary);
    }

    /**
     * 企业招聘列表
     * @return
     */
    public List<JobList> getEnterpriseRecruitmentList(String min_salary, String max_salary, String longitude, String latitude) {
        return jobMapper.getEnterpriseRecruitmentList(longitude,latitude,min_salary,max_salary);
    }
    public List<JobList> getEnterpriseRecruitment(String min_salary, String max_salary) {
        return jobMapper.getEnterpriseRecruitment(min_salary,max_salary);
    }

    /**
     * 求职详情
     * @param id
     * @param userId
     * @return
     */
    public TemporaryWorkDetails getJobWantedDetails(int id, String userId) {
        return jobMapper.getJobWantedDetails(id,userId);
    }

    /**
     * 我发布的招聘
     * @param userId
     * @return
     */
    public List<MyPublishVO> listMyPublishRecruit(String userId) {
        return jobMapper.listMyPublishRecruit(userId);
    }

    /**
     * 我发布的求职
     * @param userId
     * @return
     */
    public List<MyPublishVO> listMyPublishApply(String userId) {
        return jobMapper.listMyPublishApply(userId);
    }

    /**
     * 通过id查询求职详情
     * @param id
     * @return
     */
    public JobApply getJobById(Integer id) {
        return jobApplyMapper.getJobById(id);
    }

    /**
     * 我发布的招聘详情
     * @param userId
     * @param typeId
     * @return
     */
    public TechRecriitment findMyTechRecriitment(String userId, Integer typeId) {
        return jobMapper.findMyTechRecriitment(userId,typeId);
    }

    /**
     * 删除我发布的招聘
     * @param typeId
     */
    public void DeleteMyTechRecriitment(Integer typeId) {
        jobMapper.DeleteMyTechRecriitment(typeId);
    }

    /**
     * 我发布的求职（临工）详情
     * @param userId
     * @param typeId
     * @return
     */
    public JobHunting findMyjobHunting(String userId, Integer typeId) {
        return jobMapper.findMyjobHunting(userId,typeId);
    }

    /**
     * 删除我发布的求职（临工）详情
     * @param typeId
     */
    public void DeleteMyjobHunting(Integer typeId) {
        jobMapper.DeleteMyjobHunting(typeId);
    }


}
